import React, { Component } from 'react'

export default class App extends Component {
  constructor(props){
    super(props)
    this.iptRef = React.createRef()
  }
  handleFocus = ()=> {
    this.iptRef.current.focus()
  }
  render() {
    return (
      <div>
        <input type="text" ref={this.iptRef}/>
        <button onClick={this.handleFocus}>点击聚焦</button>
      </div>
    )
  }
}
